package org.xteam.sled.semantic.exp;

import java.util.HashSet;
import java.util.Set;

public class FreeVariableCollector extends DefaultExpVisitor {
	
	private Set<String> vars = new HashSet<String>();
	
	public static Set<String> get(Exp e) {
		FreeVariableCollector fvc = new FreeVariableCollector();
		e.visit(fvc);
		return fvc.vars;
	}
	
	@Override
	public void visitVar(ExpVar expVar) {
		vars.add(expVar.name());
	}
	

}
